package com.zr.resident.controller;

import java.util.List;
import javax.annotation.security.PermitAll;
import javax.servlet.http.HttpServletResponse;

import com.zr.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zr.common.annotation.Log;
import com.zr.common.core.controller.BaseController;
import com.zr.common.core.domain.AjaxResult;
import com.zr.common.enums.BusinessType;
import com.zr.resident.domain.EimMassesinfoNucleicposition;
import com.zr.resident.service.IEimMassesinfoNucleicpositionService;
import com.zr.common.utils.poi.ExcelUtil;
import com.zr.common.core.page.TableDataInfo;

/**
 * 核酸检测点儿Controller
 * 
 * @author zx
 * @date 2022-10-25
 */
@RestController
@RequestMapping("/eim-core/nucleicposition")
public class EimMassesinfoNucleicpositionController extends BaseController
{
    @Autowired
    private IEimMassesinfoNucleicpositionService eimMassesinfoNucleicpositionService;

    /**
     * 查询核酸检测点儿列表
     */
    @GetMapping("/list")
    @Anonymous
    @PermitAll
    public TableDataInfo list(EimMassesinfoNucleicposition eimMassesinfoNucleicposition)
    {
        startPage();
        List<EimMassesinfoNucleicposition> list = eimMassesinfoNucleicpositionService.selectEimMassesinfoNucleicpositionList(eimMassesinfoNucleicposition);
        return getDataTable(list);
    }

    /**
     * 导出核酸检测点儿列表
     */
    @PreAuthorize("@ss.hasPermi('eim-core:nucleicposition:export')")
    @Log(title = "核酸检测点儿", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EimMassesinfoNucleicposition eimMassesinfoNucleicposition)
    {
        List<EimMassesinfoNucleicposition> list = eimMassesinfoNucleicpositionService.selectEimMassesinfoNucleicpositionList(eimMassesinfoNucleicposition);
        ExcelUtil<EimMassesinfoNucleicposition> util = new ExcelUtil<EimMassesinfoNucleicposition>(EimMassesinfoNucleicposition.class);
        util.exportExcel(response, list, "核酸检测点儿数据");
    }

    /**
     * 获取核酸检测点儿详细信息
     */
    @PreAuthorize("@ss.hasPermi('eim-core:nucleicposition:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(eimMassesinfoNucleicpositionService.selectEimMassesinfoNucleicpositionById(id));
    }

    /**
     * 新增核酸检测点儿
     */
    @PreAuthorize("@ss.hasPermi('eim-core:nucleicposition:add')")
    @Log(title = "核酸检测点儿", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EimMassesinfoNucleicposition eimMassesinfoNucleicposition)
    {
        return toAjax(eimMassesinfoNucleicpositionService.insertEimMassesinfoNucleicposition(eimMassesinfoNucleicposition));
    }

    /**
     * 修改核酸检测点儿
     */

    @PostMapping("/update/app")
    @Anonymous
    @PermitAll
    public AjaxResult edit(@RequestBody EimMassesinfoNucleicposition eimMassesinfoNucleicposition)
    {
        return toAjax(eimMassesinfoNucleicpositionService.updateEimMassesinfoNucleicposition(eimMassesinfoNucleicposition));
    }

    /**
     * 定时任务修改热度
     */

    @PutMapping("/update/time")
    @Anonymous
    @PermitAll
    public AjaxResult editApp(@RequestBody EimMassesinfoNucleicposition eimMassesinfoNucleicposition)
    {
        return toAjax(eimMassesinfoNucleicpositionService.updateEimMassesinfoNucleicposition1(eimMassesinfoNucleicposition));
    }

    /**
     * 删除核酸检测点儿
     */
    @PreAuthorize("@ss.hasPermi('eim-core:nucleicposition:remove')")
    @Log(title = "核酸检测点儿", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(eimMassesinfoNucleicpositionService.deleteEimMassesinfoNucleicpositionByIds(ids));
    }
}
